import model from '../../models/cookbookModel'

// 初始化swiper数据
export const initSwiper = () => async (dispatch) => {
    let ret = await model.getSwiperData()
    dispatch({
        type: 'initSwiper',
        // 普通js对象
        data: ret.data.data
    })
}

// 热门分类
export const getHotCateData = () => async (dispatch) => {
    let data = await model.getHotCateData()
    dispatch({
        type: 'setHotcate',
        // 普通js对象
        data
    })

}


// 精品好菜
export const getGoodCookbookData = () => async (dispatch) => {
    let data = await model.getGoodCookbookData()
    dispatch({
        type: 'setGoodCookbook',
        // 普通js对象
        data
    })
}


// 分类列表
export const getCategoryData = () => async (dispatch) => {
    let data = await model.getCategoryData()
    dispatch({
        type: 'setCategoryData',
        // 普通js对象
        data
    })
}


// 分类列表
export const getMaterialData = () => async (dispatch) => {
    let data = await model.getMaterialData()
    dispatch({
        type: 'setMaterialData',
        // 普通js对象
        data
    })
}

// 菜单隐藏
export const setfooterMenu = (data = '') => ({
    type:'setfooterMenu',
    data
})